
<include file="Public/ace_header" />
<div class="row">
    <div class="col-xs-12">
        <div class="row hidden-480 search"> <!-- 查询块 -->
            <form id="search-form">
                <div class="col-md-3 search-input-div">
                    <input type="text" class="col-md-12 search-input" name="searchMap[id]" id="id" value="{$_GET[searchMap][id]}" placeholder="ID"/>
                </div>
                <div class="col-md-3 search-input-div">
                    <select class="col-md-12 search-input" name="searchMap[prize]" id="prize" placeholder="系统名称"/>
                    <option value="">请选择奖品</option>
                    <volist name="prizelist" id="vo" key="k">
                      <option <if condition="$_GET[searchMap][prize] eq $k">active</if> value="{$k-1}">{$vo}</option>
                    </volist>
                    </select>
                </div>
                <div class="col-md-3 col-md-offset-3 center search-input-div">
                    <button type="submit" class="btn btn-success btn-xs">查询</button>
                    <button class="btn btn-warning btn-xs" type="button" href="#" onclick="clearFind()">清空</button>
                    <button class="btn btn-danger btn-xs" type="button" href="javascript:void(0);" id="gamedelall">删除</button>
                </div>
            </form>
        </div>
        <div class="table-responsive">
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th class="center">
                            <label>
                                <input type="checkbox" class="ace" id="checkall"/>
                                <span class="lbl"></span>
                            </label>
                        </th>
                        <th class="center">ID</th>
                        <th class="center">用户ID</th>
                        <th class="center">用户名称</th>
                        <th class="center">奖品</th>
                        <th class="center">时间</th>
                        <th class="center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="list" id="vo">
                    <tr>
                        <td class="center">
                            <label>
                                <input type="checkbox" class="ace" name="chkid" value="{$vo['id']}"/>
                                <span class="lbl"></span>
                            </label>
                        </td>
                        <td class="center">{$vo[id]}</td>
                        <td class="center">{$vo[userid]}</td>
                        <td class="center">
                          {$vo[username]}
                        </td>
                        <td class="center">{$vo[prize]}</td>
                        <td class="center">{$vo['created_at']|default=''|date="Y-m-d H:i:s",###}</td>
                            <td class="center">
                                <div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
                                    <a class="delete-item" id="{$vo['id']}" >
                                        <button class="btn btn-xs btn-danger" style="border: 1px;">
                                            <i class="icon-trash"></i>
                                        </button>
                                    </a>
                                </div>
                            </td>
                        </tr>
                    </volist>
                </tbody>
            </table>
            {$page}
        </div><!-- /.table-responsive -->
    </div><!-- /span -->
</div><!-- /row -->
<include file="Public/ace_footer" />
<script>
$('.delete-item').click(function() {
    if (!confirm('是否确定要删除?')) {
        return false;
    }
    var id = $(this).attr('id');
    var url = 'gamedelete';
    $.post(url, {id: id}, function(data, status) {
        if (data.status == 1) {
            alert(data.msg);
            location=location;
        } else {
            alert('请求出错!');
        }
    });

});

$("#gamedelall").click(function(){
    var arrChk = $("input[name='chkid']");
    var idArr=new Array();
    arrChk.each(function(){
        if ($(this).prop("checked")) {
            idArr.push(this.value);
        }
    });
    if (idArr.length != 0) {
        if (!confirm("是否要批量删除？")) {
            return false;
        }
    } else {
        alert("请选择要删除的项!");
        return false;
    }
    var url = 'gamedelete';
    var idStr = idArr.join(",");
    $.post(url, {id: idStr}, function(data, status) {
        if (data.status == 1) {
            alert(data.msg);
            location=location;
        } else {
            alert('请求出错!');
        }
    });
})
</script>
